"""
@Time ： 2022/12/5 10:41
@Auth ： 陈杰 200320501042
@E-mail : 1612845322@qq.com
"""
from pymysql import *
conn = connect(host="localhost", port=3306, user='root', password="cj2001..", db="info", charset='utf8')
sql = '''
INSERT INTO user(loginName, password,gender, name, age)
VALUES ('%s', '%s','%s','%s', %f)
'''
cursor = conn.cursor()
while 1:
    loginName = input("输入loginName（0=退出）：")
    if loginName == "0":
        break
    password = input("输入password：")
    gender = input("输入gender：")
    name = input("输入name：")
    age = float(input("输入age："))
    cursor.execute(sql % (loginName, password, gender, name, age))
cursor.close()
conn.commit()
conn.close()
